package com.self.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.self.admin.mapper.SysMenuMapper;
import com.self.admin.model.SysMenu;
import com.self.admin.service.SysMenuService;
import com.self.admin.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService{


    @Autowired
    private SysRoleService sysRoleService;

    @Override
    public List<SysMenu> queryMenuByUserId(Long userId) {
        //是否是超级管理权限
        if (sysRoleService.isSupperAdmin(userId)){
            return list();
        }
        //查询菜单
        return baseMapper.queryMenuByUserId(userId);
    }
}
